/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * RegistroLista.java
 *
 * Created on May 31, 2009, 10:43:41 AM
 */

package dialogs;

import java.awt.Color;
import persistencia.entidade.Registro;

/**
 *
 * @author victorino
 */
public class RegistroLista extends javax.swing.JPanel {

    public RegistroLista() {
    }

    
    private Registro registro ;
    /** Creates new form RegistroLista */
    public RegistroLista(Registro registro) {
        this.registro = registro;
        initComponents();
    }

    public void setSelected(boolean selected) {
        if(selected){
          setBackground(new Color(240,240,240));
        }else{
          setBackground(Color.WHITE);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        regNome = new javax.swing.JLabel(registro.getNome());
        jLabel1 = new javax.swing.JLabel();
        imagePanel1 = new dialogs.ImagePanel(registro.getIconeMob());

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(mobcatadmin.MobCatAdminApp.class).getContext().getResourceMap(RegistroLista.class);
        setBackground(resourceMap.getColor("Form.background")); // NOI18N
        setBorder(javax.swing.BorderFactory.createEtchedBorder());
        setName("Form"); // NOI18N
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                formMouseClicked(evt);
            }
        });

        regNome.setFont(new java.awt.Font("Tahoma", 1, 11));
        regNome.setForeground(resourceMap.getColor("regNome.foreground")); // NOI18N
        regNome.setText(registro.getNome());
        regNome.setName("regNome"); // NOI18N
        regNome.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                regNomeMouseClicked(evt);
            }
        });

        jLabel1.setForeground(resourceMap.getColor("jLabel1.foreground")); // NOI18N
        jLabel1.setText(registro.getResumoMob());
        jLabel1.setName("jLabel1"); // NOI18N

        imagePanel1.setMaximumSize(new java.awt.Dimension(40, 40));
        imagePanel1.setMinimumSize(new java.awt.Dimension(40, 40));
        imagePanel1.setName("imagePanel1"); // NOI18N
        imagePanel1.setPreferredSize(new java.awt.Dimension(40, 40));
        imagePanel1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                imagePanel1MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout imagePanel1Layout = new javax.swing.GroupLayout(imagePanel1);
        imagePanel1.setLayout(imagePanel1Layout);
        imagePanel1Layout.setHorizontalGroup(
            imagePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 40, Short.MAX_VALUE)
        );
        imagePanel1Layout.setVerticalGroup(
            imagePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 40, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(16, 16, 16)
                .addComponent(imagePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(regNome)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 686, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(imagePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(regNome, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(2, 2, 2)
                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 15, Short.MAX_VALUE)))
                .addGap(15, 15, 15))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked

        
    }//GEN-LAST:event_formMouseClicked

    private void regNomeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_regNomeMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_regNomeMouseClicked

    private void imagePanel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_imagePanel1MouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_imagePanel1MouseClicked


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private dialogs.ImagePanel imagePanel1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel regNome;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the registro
     */
    public Registro getRegistro() {
        return registro;
    }

    /**
     * @param registro the registro to set
     */
    public void setRegistro(Registro registro) {
        this.registro = registro;
    }

}
